package com.liao.work.ui.activity.game;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;

import androidx.appcompat.app.AppCompatActivity;

import com.liao.work.R;
import com.liao.work.util.SetActionBarTitle;

public class GameMora2Activity extends AppCompatActivity implements View.OnClickListener {

    private RadioButton rb_s;
    private RadioButton rb_j;
    private RadioButton rb_b;
    private Button btn;
    private String s1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_game_mora2);
        SetActionBarTitle.setTitle(getSupportActionBar(), false, "猜拳游戏");
        initView();
        s1 = getIntent().getStringExtra("data");
    }

    private void initView() {
        rb_s = (RadioButton) findViewById(R.id.rb_s);
        rb_j = (RadioButton) findViewById(R.id.rb_j);
        rb_b = (RadioButton) findViewById(R.id.rb_b);
        btn = (Button) findViewById(R.id.btn);

        btn.setOnClickListener(this);
    }

    private void getData() {
        String s = "石头";
        if (rb_s.isChecked()) {
            s = "石头";
        } else if (rb_b.isChecked()) {
            s = "布";
        } else if (rb_j.isChecked()) {
            s = "剪刀";
        }
        startActivity(new Intent(this, GameMora3Activity.class).putExtra("data", s).putExtra("data1", s1));
        finish();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn:
                getData();
                break;
        }
    }
}
